﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Mysoft.MyCM.Scm;
using Mysoft.MyCM.Business;
using Mysoft.MyCM.Business.Scm;

namespace Mysoft.MyCM.Web.Controllers.WebApi.Scm
{
	/// <summary>
	/// SCM-TFS客户Api
	/// </summary>
	public class Scm_CustomController : BaseApiController
	{
		private CustomBLL _bll = new CustomBLL();

		/// <summary>
		/// 获取指定区域的TFS客户集合
		/// </summary>
		/// <param name="areaId">区域Id</param>
		/// <returns></returns>
		[ActionName("Get")]
		public List<Custom> GetList(Guid areaId)
		{
			return _bll.GetCustomsOfArea(areaId);
		}

		/// <summary>
		/// 依据关键字根据客户简称（代码）或客户名称查询客户
		/// </summary>
		/// <param name="keyword">关键字</param>
		/// <returns></returns>
		[ActionName("Get")]
		public List<Custom> GetQuery(string keyword)
		{
			return _bll.QueryCustoms(keyword);
		}

		/// <summary>
		/// 根据客户Id获取客户详情
		/// </summary>
		/// <param name="param">客户Id</param>
		/// <returns></returns>
		public Custom Get(Guid param)
		{
			return _bll.GetCustom(param);
		}

		/// <summary>
		/// 根据客户简称（代码）获取客户详情
		/// </summary>
		/// <param name="customCode">客户简称（代码）</param>
		/// <returns></returns>
		[ActionName("Get")]
		public Custom GetByCode(string customCode)
		{
			return _bll.GetCustom(customCode);
		}
	}
}
